"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZoneModel = void 0;
const fs = require("fs");
const Logger_1 = require("../engine/utils/Logger");
const path = require("path");
class ZoneModel {
    static init() {
        let configPath = path.resolve() + "/config/serverlist.json";
        Logger_1.Logger.log("serverlist====", configPath);
        let data = fs.readFileSync(configPath);
        let objList = JSON.parse(data.toString());
        this.zoneModelList = [];
        for (let i = 0; i < objList.length; i++) {
            let obj = objList[i];
            let model = new ZoneModel();
            model.server_id = obj["id"];
            model.server_index = obj["index"];
            model.server_ip = obj["ip"];
            model.server_name = obj["name"];
            model.server_port = obj["port"];
            model.server_status = obj["status"];
            model.server_type = obj["server_type"];
            model.android_switch = obj["android_switch"];
            model.ios_switch = obj["ios_switch"];
            this.zoneModelList.push(model);
        }
    }
    static getZone(id) {
        for (let i = 0; this.zoneModelList.length; i++) {
            let zone = this.zoneModelList[i];
            if (zone.server_id == id) {
                return zone;
            }
        }
    }
}
exports.ZoneModel = ZoneModel;
ZoneModel.Redis_Key = "serverlist";
ZoneModel.ZoneInfoStatus = {
    Normal: 1,
    WeiHu: 2,
    NoOpen: 3,
    Full: 4,
};
ZoneModel.zoneModelList = [];
